

using UnityEngine;
public class Camera {
	public static bool isFocus = true;
	public const int FREEZMOD = 0;
	public const int CHARMOD = 1;
	public static int mod;
	Map map = new Map();
	int mw, mh, tw;
	public int x, y;
    //public Bee player;
    

	public Camera() {
        //player = new Bee();
//		mw = GameCanvas.tilemap.mw;
//		mh = GameCanvas.tilemap.mh;
//		tw = 24;
		mw = map.GetWidth();
       // Debug.Log("Map width --> "+mw);
		mh = map.GetHeight();
     //   Debug.Log("Map hiegh --> "+mh);
		mod = CHARMOD;

        //if (mod == CHARMOD)
        //{
            //this.x = X;
            x = Screen.width / 3;
            //			this.y = Y - 2*getHeight() / 3;
            //this.y = Y - 2*Screen.height / 3;
        //}
       
	}

	public void setXY(int x, int y) {
		this.x = x;
		this.y = y;
        
	}

	public void setMOD(int nextmode) {
		mod = nextmode;
	}

	public void update(int X, int Y) {
        
//        if (mod == CHARMOD) {
//            //this.x = X;
//            x = (X - Screen.width / 3) ;
////			this.y = Y - 2*getHeight() / 3;
//            //this.y = Y - 2*Screen.height / 3;
//        }
        if (X >= Screen.width / 3)
        {
            x++;
        }
        
        
		if (x < 0) {
			x = 0;
		}
        else if (x > mw - Screen.width)
        {

            x = mw - Screen.width;
		}
        //if (y < 0)
        //    y = 0;
        //else if (y > mh - Screen.height)
        //{
        //    y = mh - Screen.height;
        //}
	}

	public void translate(mGraphics g) {
        //g.translate(-x, -y);
        g.translate(-x, -y);
    }

	protected void paint(mGraphics arg0) {
		// TODO Auto-generated method stub
	}
}
